/**
 * \file Color.h
 * \brief Color definition class
 * \author Edouard ROGE
 * \date 11 August 2012
 */

#ifndef _COLOR_
#define _COLOR_

#include "Core/Memory/HeapObject.h"

/**
 * \class Color
 * \brief class which manages only one unsigned int (32 bits) for the 4 components of a Color (red green blue alpha)
 */
class Color : public Core::Memory::HeapObject
{
public:
	/**
	 * \fn Color();
	 * \brief Default constructor
	 */
	Color();

	/**
	 * \fn Color(uint32 _color);
	 * \param _color uint32 based color to copy
	 * \brief Constructor with parameter
	 */
	Color(uint32 _color);

	/**
	 * \fn Color(const Color & _color);
	 * \param _color the color to copy
	 * \brief Copy constructor
	 */
	Color(const Color & _color);

	/**
	 * \fn Color(float _red, float _green, float _blue, float _alpha=1.0f);
	 * \param _red red value [0,1]
	 * \param _green green value [0,1]
	 * \param _blue blue value [0,1]
	 * \param _alpha alpha value [0,1]
	 * \brief Constructor with parameter
	 */
	Color(float _red, float _green, float _blue, float _alpha=1.0f);

	/**
	 * \fn Color(uint8 _red, uint8 _green, uint8 _blue, uint8 _alpha=255);
	 * \param _red red value [0,255]
	 * \param _green green value [0,255]
	 * \param _blue blue value [0,255]
	 * \param _alpha alpha value [0,255]
	 * \brief Constructor with parameter
	 */
	Color(uint8 _red, uint8 _green, uint8 _blue, uint8 _alpha=255);

	/**
	 * \fn ~Color();
	 * \brief Destructor
	 */
	~Color();

	/**
	 * \fn uint8 GetRedComponent() const;
	 * \return value of the red component
	 * \brief Retrieve the value of the red component
	 */
	uint8 GetRedComponent() const;

	/**
	 * \fn uint8 GetGreenComponent() const;
	 * \return value of the green component
	 * \brief Retrieve the value of the green component
	 */
	uint8 GetGreenComponent() const;

	/**
	 * \fn uint8 GetBlueComponent() const;
	 * \return value of the blue component
	 * \brief Retrieve the value of the blue component
	 */
	uint8 GetBlueComponent() const;

	/**
	 * \fn uint8 GetAlphaComponent() const;
	 * \return value of the alpha component
	 * \brief Retrieve the value of the alpha component
	 */
	uint8 GetAlphaComponent() const;

	/**
	 * \fn void SetRedComponent(uint8 _red);
	 * \param _red new red value [0,255]
	 * \brief Set new value for the red component
	 */
	void SetRedComponent(uint8 _red);

	/**
	 * \fn void SetGreenComponent(uint8 _green);
	 * \param _green new green value [0,255]
	 * \brief Set new value for the green component
	 */
	void SetGreenComponent(uint8 _green);

	/**
	 * \fn void SetBlueComponent(uint8 _blue);
	 * \param _blue new blue value [0,255]
	 * \brief Set new value for the blue component
	 */
	void SetBlueComponent(uint8 _blue);

	/**
	 * \fn void SetAlphaComponent(uint8 _alpha);
	 * \param _alpha new alpha value [0,255]
	 * \brief Set new value for the alpha component
	 */
	void SetAlphaComponent(uint8 _alpha);

	/**
	 * \fn void SetRedComponent(float _red);
	 * \param _red new red value [0,1]
	 * \brief Set new value for the red component
	 */
	void SetRedComponent(float _red);

	/**
	 * \fn void SetGreenComponent(float _green);
	 * \param _green new green value [0,1]
	 * \brief Set new value for the green component
	 */
	void SetGreenComponent(float _green);

	/**
	 * \fn void SetBlueComponent(float _blue);
	 * \param _blue new blue value [0,1]
	 * \brief Set new value for the blue component
	 */
	void SetBlueComponent(float _blue);

	/**
	 * \fn void SetAlphaComponent(float _alpha);
	 * \param _alpha new alpha value [0,1]
	 * \brief Set new value for the alpha component
	 */
	void SetAlphaComponent(float _alpha);

	/**
	 * \fn operator const uint32 & () const;
	 * \return the uint32 based color
	 * \brief retrieve the color as an integer on 32 bits
	 * Useful for casting
	 */
	operator const uint32 & () const;

	/**
	 * \fn operator uint32 & ();
	 * \return the uint32 based color
	 * \brief retrieve the color as an integer on 32 bits
	 * Useful for casting
	 */
	operator uint32 & ();

private:

	/** Color value, each component is encoded on 8 bits */
	uint32 m_Value;
};

#endif // _COLOR_
